# 导入模块
import unittest
from common.base_s import get_driver,By, Base
import time
from page.manage_page import ManagePage
from page.login_page import LoginPage

# 创建登录页面测试
class TestManage(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:

        cls.Manage = ManagePage(get_driver())  # 实例化浏览器
        cls.Manage.login_act()  # 实现登录
    def test_manage_01(self):


        self.Manage.get_in_menu_frame1()  # 进入 菜单栏iframe
        self.Manage.order_management1()  # 点击订单管理项

        self.Manage.quit_element_frame()  # 退出iframe
        time.sleep(2)
        self.Manage.get_in_order_frame1(2)  # 进入订单号输入框的 iframe
        time.sleep(2)


        # self.Manage.generate_number1('2023020252605')  # 订单号输入
        number1 = self.Manage.first_order_number1()
        self.Manage.generate_number1(number1)  # 订单号输入


        self.Manage.search_butten1()  # 点击搜索
        time.sleep(2)

        self.Manage.quit_element_frame()  # 退出iframe
        time.sleep(2)
        self.Manage.get_in_order_frame1(2)  # 进入查看的 iframe
        time.sleep(2)
        self.Manage.see1()  # 点击查看
        time.sleep(3)

        self.Manage.quit_element_frame()  # 退出iframe
        time.sleep(2)
        self.Manage.get_in_order_frame1(2)  # 进入详情的 iframe
        time.sleep(2)

        # print(self.Manage.number2())  # 打印订单号
        number2 = self.Manage.number2()

        # self.assertEqual(number2, '2023020252605')  # 断言是否快递单号同
        self.assertEqual(number2, str(number1))  # 断言是否快递单号同







        # print(self.Manage.express2())  # 打印快递方式
        # express2 = self.Manage.express2()
        # express2 = express2[:4]

        # print(express2)
        # self.assertEqual(express2, '申通快递')  # 断言是否快递同

        # print(self.Manage.money2())  # 打印金额


        # money2 = self.Manage.money2()
        # self.assertEqual(money2, '￥44.00元')  # 断言是否价格同


    @classmethod
    def tearDownClass(cls) -> None:
        time.sleep(3)
        cls.Manage.quit()

if __name__ == '__main__':
    unittest.main(verbosity=2)